package com.example.sfm.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.example.sfm.pojo.entity.AwardsPunishments;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author sfm
 * @since 2025-03-07
 */
@Mapper
public interface AwardsPunishmentsMapper extends BaseMapper<AwardsPunishments> {

    @Select("SELECT type, COUNT(*) as count FROM awards_punishments ${ew.customSqlSegment} GROUP BY type")
    List<Map<String, Object>> countByType(@Param(Constants.WRAPPER) Wrapper<?> wrapper);

    @Select("SELECT level, COUNT(*) as count FROM awards_punishments ${ew.customSqlSegment} GROUP BY level")
    List<Map<String, Object>> countByLevel(@Param(Constants.WRAPPER) Wrapper<?> wrapper);
}
